unsigned srl(unsigned x, int k){
    unsigned xsra = (int) x>>k;
    int w = 8*sizeof(x);
    return ((1u << (w-k))-1)& xsra;
}

int sra(int x, int k){
    int xsrl = (unsigned)x>>k; 
    int w = 8*sizeof(x);
    return (((1u<<(w-1)& x)&&1)*(-1<<(w-k)))|xsrl;


}


